{% extends 'base.html' %}

{% block title %}{{ novel.title }} - {{ chapter.title }} - 小说阅读网{% endblock %}

{% block content %}
    <div class="chapter-content">
        <h1 class="chapter-title">{{ chapter.title }}</h1>
        <div class="content">
            <!-- 章节内容，按段落分割 -->
            {% for para in content.split('。') %}
                {% if para %}
                    <p>{{ para }}。</p>
                {% endif %}
            {% endfor %}
        </div>

        <div class="chapter-nav">
            {% if prev_chapter %}
                <a href="{{ url_for('read_chapter', novel_id=novel.id, chapter_id=prev_chapter.id) }}" class="btn">上一章</a>
            {% else %}
                <span class="btn disabled">上一章</span>
            {% endif %}

            {% if next_chapter %}
                <a href="{{ url_for('read_chapter', novel_id=novel.id, chapter_id=next_chapter.id) }}" class="btn">下一章</a>
            {% else %}
                <span class="btn disabled">下一章</span>
            {% endif %}
        </div>
    </div>
{% endblock %}